package com.example.lenovo.demo.view;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;
import android.widget.ListView;
import android.widget.RelativeLayout;

import com.baidu.mapapi.BMapManager;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.LogoPosition;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MarkerOptions;
import com.baidu.mapapi.map.OverlayOptions;
import com.baidu.mapapi.model.LatLng;
import com.example.lenovo.demo.R;
import com.example.lenovo.demo.model.databean.CityBean;
import com.example.lenovo.demo.model.databean.ModelDaysBean;
import com.example.lenovo.demo.presenter.MapFgPresenter;
import com.example.lenovo.demo.view.ifgview.IMapFragment;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import java.util.List;
import java.util.Map;

/**
 * Created by Lenovo on 2017/1/10.
 */
@ContentView(R.layout.fragment_map)
public class MapFragment extends Fragment implements IMapFragment{
    private MapFgPresenter mapFgPresenter;
    @ViewInject(R.id.mapfragment_lv)
    private ListView listView;
    @ViewInject(R.id.mapfragment_elv)
    private ExpandableListView expandableListView;
    private ModelDaysBean modelDaysBean;


    private View view;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view= x.view().inject(this,inflater,container);
        init();
        return view;
    }

    private void init() {
        modelDaysBean=getArguments().getParcelable("msg");
        mapFgPresenter=new MapFgPresenter(this);
        mapFgPresenter.initData();
    }

    @Override
    public ListView getListView() {
        return listView;
    }

    @Override
    public Context myContext() {
        return getActivity();
    }

    @Override
    public ExpandableListView getExpandableLv() {
        return expandableListView;
    }

    @Override
    public MapView getMapView() {
        return (MapView) getActivity().findViewById(R.id.citymap_mapview);
    }

    @Override
    public RelativeLayout getRl() {
        return (RelativeLayout) getActivity().findViewById(R.id.activity_map_msglayout);
    }

    @Override
    public ModelDaysBean getModelDaysBean() {
        return modelDaysBean;
    }
}
